package com.shangpintechnology.sci;


import java.util.Vector;

import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

public class DataModel {
private DefaultTableModel todayVipTable;
private DefaultTableModel currentVipHistoryTable;
public static String[] todayColumnName ;
public static String[] historyColumnName;
static {
	todayColumnName = new String[3];
	todayColumnName[0]=new String("时间");
	todayColumnName[1]=new String("姓名");
	todayColumnName[2]=new String("等级");
	
	}
static{
	historyColumnName = new String[4];
	historyColumnName[0]=new String("时间");
	historyColumnName[1]=new String("客服代表");
	historyColumnName[2]=new String("服务网点");
	historyColumnName[3]=new String("服务编号");
	}
private DAO defaultDAO;
private String currentVipCode;
public String[] getTodayColumnName() {
	return todayColumnName;
}
 

public DataModel() {
	super();
	this.defaultDAO = new DAO();
}

public DefaultTableModel getTodayVipTable() {
	String[][] todayVip = defaultDAO.getTodayVip();
	todayVipTable = new DefaultTableModel (todayVip,todayColumnName){

		  public boolean isCellEditable(int arg0, int arg1){
			  return false;
		  }
	};
	return todayVipTable;
}
public AccountInfo getVip(String Vipcode){
	
	return defaultDAO.getVip(Vipcode);
}

public void setTodayVipTable(DefaultTableModel  todayVipTable) {
	this.todayVipTable = todayVipTable;
}
public DefaultTableModel  getCurrentVipHistoryTable(String vipCode) {
	String[][] vipHistory = defaultDAO.getServiceHistory(vipCode);
 /*Vector v2 = new Vector();
 Vector v3 = new Vector();
 v3.add(new String());
 v3.add(new String());
 v3.add(new String());
 v3.add(new String());
 v2.add(v3);*/
	currentVipHistoryTable = new DefaultTableModel(vipHistory, historyColumnName){

		  public boolean isCellEditable(int arg0, int arg1){
			  return false;
		  }
		  };
	return currentVipHistoryTable;
}
public void setCurrentVipHistoryTable(DefaultTableModel  currentVipHistoryTable) {
	
	this.currentVipHistoryTable = currentVipHistoryTable;
}

public Vector getVipCodeHistory() {
	return defaultDAO.getVipCodeHistory();
}

public boolean updateVipCode(JTextField vipCode, JTextField rfidCode) {
	return false;
	
}


public boolean updateAccountInfo(String vipcode,String username, String age, String bankcard,
		String sex, String riskstage, String passtype, String passcode) {
	return defaultDAO.updateAccountInfo(vipcode,username,age,bankcard,sex,riskstage,passtype,passcode);
		
}

public String[] getAccountInfo(String name) {
	return defaultDAO.getAccountInfo(name);
}



public String[][] searchVip(String name) {
	return defaultDAO.searchAccountInfo(name);
}

public String getRfidCode(String id) {
	
	return defaultDAO.getRfidCode(id);
}

public String getVipCodebyRfid(String epc) {
	return defaultDAO.getVipCodebyRfid(epc);
	
}

public Vector getHistoryPersonalInfo(String vipCode) {
	return defaultDAO.getHistoryPersonalInfo(vipCode);
	
}
public void setCurrentVipCode(String vipCode) {
	this.currentVipCode = vipCode;
	
}






}
